﻿namespace PowerSong.UserInterface.Tasks
    {
    using System;
    using System.IO;

    public class InstallTranslationTask : Task
        {

        private string fileName = string.Empty;

        public InstallTranslationTask(string fileName)
            : base("Installing", "Installing Bible translation '" + Path.GetFileNameWithoutExtension(fileName) + "'")
            {
            this.fileName = fileName;
            }

        public override void Execute()
            {

            // Install the bible translation
            BibleTranslationManager.InstallTranslation(fileName);

            }

        public override void HandleException(Exception ex)
            {
            Utilities.ShowErrorMessage("Cannot Install Translation", "Cannot install the bible translation '" + Path.GetFileNameWithoutExtension(fileName) + "':", ex.Message);
            }

        }

    }
